﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace PCS_Linh.lab01
{
    class DateInMonth
    {
        public void run()
        {
            Console.Write("Please enter any year: ");
            int year = Convert.ToInt32(Console.ReadLine());

            Console.Write("Please enter any month of this year: ");
            int month = Convert.ToInt32(Console.ReadLine());

            if (year > 0)
            {
                switch (month)
                {
                    case 1:
                    case 3:
                    case 5:
                    case 7:
                    case 8:
                    case 10:
                    case 12:
                        Console.WriteLine("The {0}/{1} has 31 days", month, year);
                        break;
                    case 4:
                    case 6:
                    case 9:
                    case 11:
                        Console.WriteLine("The {0}/{1} has 30 days", month, year);
                        break;
                    case 2:
                        if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0)
                        {
                            Console.WriteLine("The {0}/{1} has 29 days", month, year);
                        }
                        else
                        {
                            Console.WriteLine("The {0}/{1} has 28 days", month, year);
                        }
                        break;
                    default:
                        Console.WriteLine("Invalid month!");
                        break;
                }
            }
            else
            {
                Console.WriteLine("Invalid year!");
            }
        }
    }
}
